from dataclasses import dataclass
from os.path import join, abspath, dirname, exists
from os import makedirs

from loguru import logger


@dataclass(frozen=True)
class DirPath:
    CONFIG = dirname(abspath(__file__))
    MAIN_MODULE = dirname(CONFIG)
    ROOT = dirname(MAIN_MODULE)
    AI_BLOGS = join(ROOT, "ai_blogs")

    @staticmethod
    def make_dir(path: str):
        if not exists(path):
            makedirs(path)
            logger.success(f"Created directory: {path}")
        else:
            logger.info(f"Directory already exists: {path}")
